<?php
namespace Amis\functions;

use Amis\Basics\AmisBasics;

class AnchorNav extends AmisBasics
{
    public string $type = 'anchor-nav';


    public function className($className)
    {
        $this->className = $className;
        return $this;
    }

    public function linkClassName($linkClassName)
    {
        $this->linkClassName = $linkClassName;
        return $this;
    }

    public function sectionClassName($sectionClassName)
    {
        $this->sectionClassName = $sectionClassName;
        return $this;
    }

    public function links(array $links)
    {
        foreach ($links as $link) {
            $this->links[] = $this->link($link);
        }
        return $this;
    }

    public function link(array $link)
    {
        $links['title']     = $link['title'] ?: '';
        $links['href']      = $link['href'] ?: '';
        $links['body']      = $link['body'] ?: '';
        $links['className'] = $link['className'] ?: '';
        return $links;
    }

    public function direction($direction = 'vertical')
    {
        $this->direction = $direction == 'vertical' ?: 'horizontal';
        return $this;
    }

    public function active(string $active)
    {
        $this->active = $active;
        return $this;
    }
}